package com.xyht.sca_s.student_manage_system.modules.advanceRegistration.controller;


import com.xyht.sca_s.student_manage_system.auth.util.JwtTokenUtil;
import com.xyht.sca_s.student_manage_system.common.annotation.RequestPass;
import com.xyht.sca_s.student_manage_system.common.commonReturn.ResponseResult;
import com.xyht.sca_s.student_manage_system.common.desEncodeAndDecode.annotation.SecretBody;
import com.xyht.sca_s.student_manage_system.modules.advanceRegistration.entity.req.RxAdvanceRegistrationOrgReq;
import com.xyht.sca_s.student_manage_system.modules.advanceRegistration.entity.req.RxAdvanceRegistrationPaymentItemReq;
import com.xyht.sca_s.student_manage_system.modules.advanceRegistration.service.RxAdvanceRegistrationOrgService;
import com.xyht.sca_s.student_manage_system.modules.advanceRegistration.service.RxAdvanceRegistrationPaymentItemService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 预报名缴费项目金额表 前端控制器
 * </p>
 *
 * @author XYHT
 * @since 2024-04-10
 */
@RestController
@RequestMapping("/advanceRegistration/paymentItem")
@SecretBody
public class RxAdvanceRegistrationPaymentItemController {

    @Resource
    private RxAdvanceRegistrationPaymentItemService advanceRegistrationPaymentItemService;
    @Resource
    private JwtTokenUtil jwtTokenUtil;

    @ApiOperation("添加收费项")
    @PostMapping("/add")
    public ResponseResult addAdvanceRegistrationPaymentItem(@RequestBody RxAdvanceRegistrationPaymentItemReq addReq, HttpServletRequest request) {
        String userId = jwtTokenUtil.getUserIdByRequest(request);
        return advanceRegistrationPaymentItemService.addAdvanceRegistrationPaymentItem(addReq, userId);
    }

    @ApiOperation("修改收费项")
    @PostMapping("/update")
    public ResponseResult updateAdvanceRegistrationPaymentItem(@RequestBody RxAdvanceRegistrationPaymentItemReq updateReq) {
        return advanceRegistrationPaymentItemService.updateAdvanceRegistrationPaymentItem(updateReq);
    }

    @ApiOperation("查看收费详情")
    @GetMapping("/detail")
    @RequestPass
    public ResponseResult getAdvanceRegistrationOrgDetail() {
        return advanceRegistrationPaymentItemService.getAdvanceRegistrationPaymentItemDetail();
    }
}

